//滑动窗口
int sumAll(int *nums,int numsSize){
    int sum = 0;
    for(int i=0;i<numsSize;i++){
        sum+=nums[i];
    }
    return sum;
}
int min(int a,int b){
    return a>b?b:a;
}
int minSubArrayLen(int target, int* nums, int numsSize){
    int minLen = numsSize+1;
    if (sumAll(nums,numsSize)<target) return 0;
    else minLen = numsSize;

    int begin = 0,end = 0,sum = nums[begin];
    while(1){
        if (sum>=target){
            minLen = min(minLen,end-begin+1);
            sum -= nums[begin];
            begin++;
        }else{
            if (end==numsSize-1) break;//如果end到头，begin再后移也没用，所以到了终点
            end++;
            sum+=nums[end];
        }
    }
    return minLen;
}